# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
import numpy as np
from SpectrumA2 import spectrumA
#from matplotlib import pyplot as plt

T = np.linspace(0,5,500)

dt = np.loadtxt('C:/Users/rober/Documents/ROSE/PhD/Thesis/CaseStudies/Records/sa(1)/9975/GMx/dts.txt')
Npt = np.loadtxt('C:/Users/rober/Documents/ROSE/PhD/Thesis/CaseStudies/Records/sa(1)/9975/GMx/Npts.txt')

for i in range(20):
    
    fHandle = 'C:/Users/rober/Documents/ROSE/PhD/Thesis/CaseStudies/Records/sa(1)/9975/GMx/GM'+str(i+1)+'.g3'
    Sa = spectrumA(fHandle,dt[i],Npt[i],T)
    
    outfile = open('C:/Users/rober/Documents/ROSE/PhD/Thesis/CaseStudies/Records/GroundSpectra/Acceleration/sa(1)/9975/GMx/GM'+str(i+1)+'.txt','w')
    
    for k in range(len(Sa)):
        outfile.write(str(T[k])+' '+str(Sa[k])+'\n')
        
    outfile.close()
    
    